package com.wesley.responsibilityChain;

import java.util.ArrayList;
import java.util.List;

public class FilterChain {

    private List<Filter> filters = new ArrayList<>();

    public FilterChain addFilters(Filter filter) {
        this.filters.add(filter);
        return this;
    }

    public String doFilter(String msg) {
        for (Filter filter : filters) {
            msg = filter.doFilter(msg);
        }
        return msg;
    }

}
